package com.chinaums.xm.wechat.controller;

import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.chinaums.xm.wechat.commons.SignUtil;
import com.chinaums.xm.wechat.service.wechat.CommonService;

/**
 * @author chenjf
 */
@RequestMapping("/wechat")
@Controller
public class JsSdkController {
	
	@Resource
	private CommonService commonService;
	
	@RequestMapping(value = { "/jssdkConfig" }, method = RequestMethod.POST)
	public Map<String, String> jssdkConfig(HttpServletRequest request){
		final String url = request.getParameter("url");
		return SignUtil.sign(commonService.getJsApiTicket().get(),url);
	}
}
